import Mock from "mockjs";

Mock.mock("/mock/public/addressData/getConditionTargetAddressList", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 6, //总记录数
    items: [
      {
        count: 10,
        target_address: "杭州大厦1座",
      },
      {
        count: 11,
        target_address: "黄龙时代广场2座14楼2201A-03-7工位",
      },
      {
        count: 12,
        target_address: "杭州大厦3座",
      },
      {
        count: 13,
        target_address: "瑞丰国际商务大厦",
      },
      {
        count: 14,
        target_address: "杭州大厦5座",
      },
      {
        count: 15,
        target_address: "杭州大厦6座",
      },
    ],
  },
});

Mock.mock("/mock/public/addressData/groupingStatistics", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 6, //总记录数
    target_address_num: 28,
    items: [
      {
        count: 1,
        target_address: "杭州大厦10座",
      },
      {
        count: 2,
        target_address: "黄龙时代广场2座14楼22011A-03-7工位",
      },
      {
        count: 3,
        target_address: "杭州大厦12座",
      },
      {
        count: 4,
        target_address: "瑞丰国际商务13厦",
      },
      {
        count: 5,
        target_address: "杭州大厦14座",
      },
      {
        count: 6,
        target_address: "杭州大厦15座",
      },
      {
        count: 7,
        target_address: "杭州大厦16座",
      },
      {
        count: 8,
        target_address: "杭州大厦17座",
      },
      {
        count: 9,
        target_address: "杭州大厦18座",
      },
      {
        count: 10,
        target_address: "杭州大厦19座",
      },
      {
        count: 11,
        target_address: "杭州大厦20座",
      },
      {
        count: 12,
        target_address: "杭州大厦21座",
      },
      {
        count: 13,
        target_address: "杭州大厦22座",
      },
      {
        count: 14,
        target_address: "杭州大厦23座",
      },
      {
        count: 15,
        target_address: "杭州大厦24座",
      },
      {
        count: 16,
        target_address: "杭州大厦25座",
      },
      {
        count: 17,
        target_address: "杭州大厦26座",
      },
      {
        count: 18,
        target_address: "杭州大厦27座",
      },
      {
        count: 19,
        target_address: "杭州大厦28座",
      },
      {
        count: 20,
        target_address: "杭州大厦29座",
      },
      {
        count: 21,
        target_address: "杭州大厦30座",
      },
      {
        count: 22,
        target_address: "杭州大厦31座",
      },
      {
        count: 23,
        target_address: "杭州大厦32座",
      },
      {
        count: 24,
        target_address: "杭州大厦33座",
      },
      {
        count: 25,
        target_address: "杭州大厦34座",
      },
      {
        count: 26,
        target_address: "杭州大厦35座",
      },
      {
        count: 27,
        target_address: "杭州大厦36座",
      },
      {
        count: 28,
        target_address: "杭州大厦37座",
      },
    ],
  },
});

Mock.mock("/mock/public/addressData/query", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 5, //总记录数
    items: [
      {
        id: "2",
        obj_number: "2",
        obj_name: "黄龙时代广场A座2楼",
        source_address: "杭州大厦A座2室",
        details: "2.详情很多文字配",
        target_address: "目标地址2",
        supplementary_address: "补充地址2",
        standard_address: "标准地址2",
        lng: "120.28117974713444", //gcj02坐标系
        lat: "30.19697110486995", //gcj02坐标系
      },
      {
        id: "3",
        obj_number: "3",
        obj_name: "黄龙时代广场A座3楼",
        source_address: "杭州大厦A座3室",
        details: "3.详情很多文字没不能配详情很多文字空发的得人成吗没不能配",
        target_address: "目标地址3",
        supplementary_address: "补充地址3",
        standard_address: "标准地址3",
        lng: "120.21752888470888", //gcj02坐标系
        lat: "30.242048434496805", //gcj02坐标系
      },
      {
        id: "4",
        obj_number: "4",
        obj_name: "黄龙时代广场A座4楼",
        source_address: "杭州大厦A座4室",
        details:
          "4.详情很多文字空发的得人成吗没不能配详情很多文字空发的得人成吗没不能配详情很多文字空发的得人成吗没不能配",
        target4_address: "目标地址",
        supplementary_address: "补充地址4",
        standard_address: "标准地址4",
        lng: "120.26228959009052", //gcj02坐标系
        lat: "30.180289484319324", //gcj02坐标系
      },
      {
        id: "5",
        obj_number: "5",
        obj_name: "黄龙时代广场A座5楼",
        source_address: "杭州大厦A座5室",
        details: "5.详情很很多文字空发的得人成吗没不能配",
        target_address: "目标地址5",
        supplementary_address: "补充地址5",
        standard_address: "标准地址5",
        lng: "120.171493", //gcj02坐标系
        lat: "30.237884", //gcj02坐标系
      },
    ],
  },
});

Mock.mock("/mock/public/addressData/updateTargetAddress", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    data: 3,
  },
});

Mock.mock("/mock/public/addressData/standardAddr", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    items: function() {
      let standardAddrs = JSON.parse(localStorage.getItem("standardAddr"));
      let standardAddrsRes = new Array(10).fill(0).map((item, i) => {
        let ranNum = Math.floor(Math.random() * standardAddrs.length);
        console.log(ranNum, "ranNum");
        return {
          point: [
            standardAddrs[ranNum].points[1],
            standardAddrs[ranNum].points[0],
          ],
          id: new Date().getTime() + i,
          isCheck: false,
          addr: "上号efc大厦" + (i + 1),
          detailaddr: "上号efc大厦详情很多字段" + (i + 1),
        };
      });
      return standardAddrsRes;
    },
  },
});

Mock.mock("/mock/public/importFileRecord/query", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 6, //总记录数
    items: [
      {
        id: 1000000,
        file_name: "文件名称0",
        data_type: "数据类型0",
        data_source: "数据来源0",
        user_name: "最新上传人0",
        update_date: "2021-10-27 12:01", //通过update_time 时间戳转换
        import_status: "等待导入",
        api_handle_status: "待处理",
        handle_status: "待处理",
        success_count: 0,
        fail_count: 0,
        fail_message: "找不到文件", //此处判断 fail_count > 0 则显示下载失败文件的提示，链接接口是 失败文件接口，否则按实际内容展示
      },
      {
        id: 1010101,
        file_name: "文件名称1",
        data_type: "数据类型1",
        data_source: "数据来源1",
        user_name: "最新上传人1",
        update_date: "2021-10-27 12:01", //通过update_time 时间戳转换
        import_status: "等待导入",
        api_handle_status: "待处理",
        handle_status: "待处理",
        success_count: 0,
        fail_count: 0,
        fail_message: "找不到文件", //此处判断 fail_count > 0 则显示下载失败文件的提示，链接接口是 失败文件接口，否则按实际内容展示
      },
      {
        id: 1020202,
        file_name: "文件名称2",
        data_type: "数据类型2",
        data_source: "数据来源2",
        user_name: "最新上传人2",
        update_date: "2021-10-27 12:01", //通过update_time 时间戳转换
        import_status: "等待导入",
        api_handle_status: "待处理",
        handle_status: "待处理",
        success_count: 0,
        fail_count: 0,
        fail_message: "找不到文件", //此处判断 fail_count > 0 则显示下载失败文件的提示，链接接口是 失败文件接口，否则按实际内容展示
      },
      {
        id: 1030303,
        file_name: "文件名称3",
        data_type: "数据类型3",
        data_source: "数据来源3",
        user_name: "最新上传人3",
        update_date: "2021-10-27 12:01", //通过update_time 时间戳转换
        import_status: "等待导入",
        api_handle_status: "待处理",
        handle_status: "待处理",
        success_count: 0,
        fail_count: 0,
        fail_message: "找不到文件", //此处判断 fail_count > 0 则显示下载失败文件的提示，链接接口是 失败文件接口，否则按实际内容展示
      },
      {
        id: 1040404,
        file_name: "文件名称4",
        data_type: "数据类型4",
        data_source: "数据来源4",
        user_name: "最新上传人4",
        update_date: "2021-10-27 12:01", //通过update_time 时间戳转换
        import_status: "等待导入",
        api_handle_status: "待处理",
        handle_status: "待处理",
        success_count: 0,
        fail_count: 0,
        fail_message: "找不到文件", //此处判断 fail_count > 0 则显示下载失败文件的提示，链接接口是 失败文件接口，否则按实际内容展示
      },
      {
        id: 1050505,
        file_name: "文件名称5",
        data_type: "数据类型5",
        data_source: "数据来源5",
        user_name: "最新上传人5",
        update_date: "2021-10-27 12:01", //通过update_time 时间戳转换
        import_status: "等待导入",
        api_handle_status: "待处理",
        handle_status: "待处理",
        success_count: 0,
        fail_count: 0,
        fail_message: "找不到文件", //此处判断 fail_count > 0 则显示下载失败文件的提示，链接接口是 失败文件接口，否则按实际内容展示
      },
    ],
  },
});

Mock.mock("/mock/public/operationLog/save", {
  retCode: 2000,
  retMessage: "success",
  data: {
    tet: "添加成功",
  },
});

Mock.mock("/mock/public/addressData/sureAddress", {
  retCode: 2000,
  retMessage: "success",
  data: {
    tet: "操作成功",
  },
});

Mock.mock("/mock/public/operationLog/query", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 6, //总记录数
    items: [
      {
        login_name: "登陆账号",
        user_name: "姓名",
        ip: "192.168.1.1",
        title: "合并目标地址",
        content: {
          old_target_address: ["旧地址1"],
          new_target_address: "新地址",
        },
        cdate: "2021-10-29 16:41", //根据ctime转换成日期格式
      },
      {
        login_name: "登陆账号",
        user_name: "姓名",
        ip: "192.168.1.1",
        title: "登陆",
        content: null,
        cdate: "2021-10-29 16:41",
      },
      {
        login_name: "登陆账号",
        user_name: "姓名",
        ip: "192.168.1.1",
        title: "合并目标地址",
        content: {
          id: "地址主键id",
          obj_number: "对象编号",
          obj_name: "对象名称",
          old_target_address: "旧地址1",
          new_target_address: "新地址",
        },
        cdate: "2021-10-29 16:41",
      },
    ],
  },
});

Mock.mock("/mock/public/standardAddress/search", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 6, //总记录数
    items: [
      {
        value: 1,
        id: 1,
        addr: "画沙大厦",
        detailaddr: "画沙大厦详情很多字段",
        point: ["114.95577091634271", "28.23247165721544"],
        isCheck: false,
      },
      {
        value: 2,
        id: 2,
        addr: "美国大厦",
        detailaddr: "美国大厦详情很多字段",
        point: ["120.28117974713444", "30.19697110486995"],
        isCheck: false,
      },
      {
        value: 3,
        id: 3,
        addr: "澳洲金融大厦",
        detailaddr: "澳洲金融大厦详情很多字段",
        point: ["120.21752888470888", "30.242048434496805"],
        isCheck: false,
      },
      {
        value: 4,
        id: 4,
        addr: "上号efc大厦",
        detailaddr: "上号efc大厦详情很多字段",
        point: ["120.26228959009052", "30.180289484319324"],
        isCheck: false,
      },
      {
        value: 5,
        id: 5,
        addr: "黄龙时代广场",
        detailaddr:
          "黄龙时代广场详情很多字段黄龙时代广场详情很多字段黄龙时代广场详情很多字段",
        point: ["120.171493", "30.237884"],
        isCheck: false,
      },
    ],
  },
});

Mock.mock("/mock/public/dataSource/query", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 6, //总记录数
    items: [
      {
        name: "资管",
      },
      {
        name: "esop1",
      },
      {
        name: "esop2",
      },
      {
        name: "esop3",
      },
      {
        name: "esop4",
      },
      {
        name: "esop5",
      },
      {
        name: "esop6",
      },
      {
        name: "esop7",
      },
      {
        name: "esop8",
      },
      {
        name: "esop9",
      },
      {
        name: "esop10",
      },
      {
        name: "esop11",
      },
      {
        name: "esop12",
      },
      {
        name: "esop13",
      },
    ],
  },
});

Mock.mock("/mock/public/dataType/query", {
  retCode: 2000,
  retMessage: "success",
  rows: {
    total_page: 1, //总页数
    total_num: 6, //总记录数
    items: [
      {
        name: "资管",
      },
      {
        name: "esop1",
      },
      {
        name: "esop2",
      },
      {
        name: "esop3",
      },
      {
        name: "esop4",
      },
      {
        name: "esop5",
      },
      {
        name: "esop6",
      },
      {
        name: "esop7",
      },
      {
        name: "esop7",
      },
      {
        name: "esop8",
      },
      {
        name: "esop9",
      },
      {
        name: "esop10",
      },
      {
        name: "esop11",
      },
      {
        name: "esop12",
      },
    ],
  },
});
